package com.jasonchoi.eurekaclient1.controller;

import com.jasonchoi.eurekaclient1.remote.Client2RemoteService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: JasonChoi
 * @Date: 2020/2/21 16:04
 */
@Log4j2
@RestController
@RequestMapping("/client1")
public class TestController {

    @Autowired
    private Client2RemoteService client2RemoteService;

    @RequestMapping()
    public String hello(){
        log.info("----------client1 log info test");
        log.debug("----------client1 log debug test");
        log.error("----------client1 log error test");
        return "client1 log test";
    }

    @RequestMapping("/ex")
    public String ex() {
        int i = 1 / 0;
        return "client1 log test";
    }

    @RequestMapping("/remote")
    public String remote(){
        log.info("----------client1 log info test----------");
        log.debug("----------client1 log debug test----------");
        log.error("----------client1 log error test----------");
        String client2Result = client2RemoteService.hello();
        return "client1 log test , " + client2Result;
    }
}
